#ifndef SCANLINE_RASTERIZER_H_
#define SCANLINE_RASTERIZER_H_

#include <Rasterizer.h>



ATTRIBUTE_ALIGNED16(struct) Edge {
	Fragment* f1, *f2;
	Vec4 diff;
	//double xdiff, ydiff, zdiff, wdiff;
	Real varyingsdiff[MAX_VARYINGS];

};

ATTRIBUTE_ALIGNED16(struct) Span {
	Fragment *f1, *f2;
	Vec4 diff;
	//double xdiff, zdiff, wdiff;
	Real varyingsdiff[MAX_VARYINGS];
};

ATTRIBUTE_ALIGNED16(class) ScanLineRasterizer : public AbstractRasterizer
{
public:
	ScanLineRasterizer();
	virtual ~ScanLineRasterizer();

protected:
	virtual void prepareForRender();
	virtual void renderMesh(const Mesh& mesh);

protected:
	void drawTriangle(const Vertex* v);
	void rasterizeTriangle(TransformedVertex* tv);
	void drawSpanBetweenEdges(Edge& longEdge, Edge& shortEdge);
	void drawSpan(Span& span, int &y);
};

#endif //SCANLINE_RASTERIZER_H_